package com.qf.day03.loop;

/**
 * 输出100~1000的水仙花数
 */
public class NarcissisticNum {
    public static void main(String[] args) {
        int a,b,c;
        System.out.println("水仙花数有：");
        for (int i = 100; i < 1000; i++) {
            //a^3+b^3+c^3= a*100+b*10+c;
            a=i/100;
            b=(i/10)%10;
            c=i%10;
            int n = a*a*a+b*b*b+c*c*c;
            if(i==n){
                System.out.println(i);
            }
        }
    }
}
